#ifndef THREECARDRUMMYHAND_H
#define THREECARDRUMMYHAND_H

#include "hand.h"

//***************************************************************************************
// This class evaluates a Three Card Rummy hand and adds up the value of the cards.
//
// Aces count as 1 point, face cards count as 10 points, and numbered cards count as that
// number of points.
//
// Pairs, triples, and 2 or 3 card same-suit straights result in those cards not being
// added into the hand's final score.
//
// Lowest possible hand score is zero.  Highest is 30.
//  
// See TCRummyRanks enum for possible hand types (pair, triple, 2 card straight, etc).
//
//  kharmon.  01-31-06.  #5862.
// 
//***************************************************************************************
class ThreeCardRummyHand : public Hand
{
    public:
        ThreeCardRummyHand(CardMgr* Mgr);

        bool8 rankHand();               // does the actual work of calculating the hand's rank and point score.

        // the methods below are only valid after "rankHand()" has been called on the instance
        int32 getRank();                // returns current hand rank.
        bool8 qualifies();              // returns true if the point score for this hand is <=20.

        int32 outRank(uint8* Buf);      // writes the rank value to a character buffer, as 1 byte.
        int32 outScore(uint8* Buf);     // writes the point score to a chara

        uint8 getScore();               // returns sum of card point values in the current hand.

    protected:        

        int32 m_nHandRank;              // Does the hand contain pairs, triples, etc?
        uint8 m_nScore;                 // Sum of card point values in this hand.

        static uint8 m_anPoints[13];    // used for easy lookup of how many points each card "rank" counts for.  Ace is at 0, King is at 12.
};

inline int32
ThreeCardRummyHand::getRank()
{
    // "rankHand()" method must be called first.
    return m_nHandRank;
}

inline uint8
ThreeCardRummyHand::getScore()
{
    // "rankHand()" method must be called first.
    return m_nScore;
}

#endif
